package com.handinglian.servicerecord.service;


import com.github.pagehelper.PageInfo;
import com.handinglian.employee.entity.FileInfo;
import com.handinglian.servicerecord.dto.CallRecordAppDto;
import com.handinglian.servicerecord.dto.CallRecordDetailDto;
import com.handinglian.servicerecord.dto.CallRecordDto;
import com.handinglian.servicerecord.dto.IndexDto;
import com.handinglian.servicerecord.entity.CallRecord;
import com.handinglian.servicerecord.param.CallRecordCreateParam;
import org.springframework.ui.ModelMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.concurrent.ExecutionException;

public interface CallRecordService {
    PageInfo<CallRecordDto> inquireCallRecordPageList(Integer userId, String startDate, String endDate, String userNameOrJobNum, String mobilePhone, String recordStatus, String phoneStatus, String hasRecords, String sortField, String sortOrder, Integer pageIndex, Integer pageSize);

    /**
    * 获取通话记录
    * @author pxl
    * @param answerState 1未接 0所有
    * @param userId 用户id
    * @return java.util.List<com.handinglian.servicerecord.dto.CallRecordDto>
    * @date 2019/9/18 10:21
    */
    List<CallRecordAppDto> list(Integer answerState, Integer userId);

    CallRecordDetailDto loadCallRecordDetail(Integer callRecordId);

    List<FileInfo> inquireCallRecordingList(List<String> reqids);

    /**
     * 获取文件
     */
    FileInfo getFileInfo(String callid);

    String downloadRecording(String callid) throws IOException;

    /**
    * 推送通话记录
    * @author pxl
    * @param callRecordCreateParams
    * @return int 返回0为推送失败 其他为推送成功
    * @date 2019/8/22 14:23
    */
    int createCallRecord(List<CallRecordCreateParam> callRecordCreateParams);

    List<String> inquireReqidByStartTime(String startDate, String endDate);

    int createCallRecordBatch(List<CallRecord> callRecordList);

    /**
    * 查询该任务下以呼叫的客户数量
    * @author pxl
    * @param taskUserIds
    * @return int
    * @date 2019/10/17 16:35
    */
    int countTaskCallNum(List<Integer> taskUserIds);

    /**
    * 查询该任务下呼通的客户数量
    * @author pxl
    * @param taskUserIds
    * @return int
    * @date 2019/10/17 16:36
    */
    int countTaskAnswerNum(List<Integer> taskUserIds);

    /**
    * 查询员工呼叫的客户通话记录
    * @author pxl
    * @param userIds
    * @return java.util.List<com.handinglian.servicerecord.entity.CallRecord>
    * @date 2019/8/28 11:57
    */
    List<CallRecord> inquireCallRecordByUserId(Collection userIds);

    /**
    * 查询某任务下员工呼叫的通话记录
    * @author pxl
    * @param taskId
    * @return java.util.List<com.handinglian.servicerecord.entity.CallRecord>
    * @date 2019/10/22 17:47
    */
    List<CallRecord> listTaskCallRecord(Integer taskId);

    /**
    * 查询员工呼通的客户通话记录
    * @author pxl
    * @param userIds
    * @return java.util.List<com.handinglian.servicerecord.entity.CallRecord>
    * @date 2019/8/28 11:57
    */
    List<CallRecord> inquireAnswerRecordByUserId(Collection userIds);

    /**
    * 查询某任务下员工呼通的客户通话记录
    * @author pxl
    * @param taskId
    * @return java.util.List<com.handinglian.servicerecord.entity.CallRecord>
    * @date 2019/10/22 17:48
    */
    List<CallRecord> listAnswerRecord(Integer taskId);

    CallRecord loadCallRecordByUserIdCustomerNo(Integer userId, String customerNo, Date operationTime);

    /**
     * 查询客户被呼叫的通话记录
     * @author pxl
     * @param customerNo
     * @return java.util.List<com.handinglian.servicerecord.entity.CallRecord>
     * @date 2019/8/28 11:57
     */
    List<CallRecord> inquireCallRecordByCustomerNo(Integer userId, String customerNo);

    /**
     * 查询客户被呼通的通话记录
     * @author pxl
     * @param customerNo
     * @return java.util.List<com.handinglian.servicerecord.entity.CallRecord>
     * @date 2019/8/28 11:57
     */
    List<CallRecord> inquireAnswerRecordByCustomerNo(Integer userId, String customerNo);

    /**
    * 获取首页信息
    * @author pxl
    * @param
    * @return com.handinglian.servicerecord.dto.IndexDto
    * @date 2019/9/18 17:57
    */
    IndexDto getIndex() throws ExecutionException, InterruptedException;

    CallRecord get(Integer callRecordId);

    void exportCallRecord(ModelMap map, HttpServletRequest request, HttpServletResponse response);
}
